package com.aim.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Import;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @AUTO
 * @FILE RootConfig.java
 * @DATE 2021年4月25日 上午9:43:51
 * @Author AIM
 * @Version
 */
@Configuration
// 开启事务支持
@EnableTransactionManagement
@Import(DruidConfig.class)
// 导入数据源的配置
@ComponentScan(basePackages = { "com.aim" }, excludeFilters = { @Filter(type = FilterType.ANNOTATION, classes = { Controller.class }) })
public class SpringRootConfig {

	@Bean
	public static PropertySourcesPlaceholderConfigurer getPropert() {
		PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
		ppc.setLocation(new ClassPathResource("jdbc.properties"));
		ppc.setIgnoreUnresolvablePlaceholders(true);
		return ppc;
	}
}
